agora inbox for [email protected]  
help / color / mirror / Atom feed
Re: Unused system table columns
972+ messages / 4 participants
[nested] [flat]

* Re: Unused system table columns
@ 2002-07-15 22:03 Hannu Krosing <[email protected]>
  2002-07-16 00:19 ` Re: Unused system table columns Bruce Momjian <[email protected]>
  2002-07-16 06:13 ` Re: Unused system table columns Tom Lane <[email protected]>
  0 siblings, 2 replies; 972+ messages in thread

From: Hannu Krosing @ 2002-07-15 22:03 UTC (permalink / raw)
  To: Bruce Momjian <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; pgsql-hackers

On Tue, 2002-07-16 at 04:55, Bruce Momjian wrote:
> Hannu Krosing wrote:
> > On Tue, 2002-07-16 at 03:53, Peter Eisentraut wrote:
> > > The following system table columns are currently unused and don't appear
> > > to be in the line of resurrection.
> > > 
> > > pg_language.lancompiler
> > > pg_operator.oprprec
> > > pg_operator.oprisleft
> > > pg_proc.probyte_pct
> > > pg_proc.properbyte_cpu
> > > pg_proc.propercall_cpu
> > > pg_proc.prooutin_ratio
> > > pg_shadow.usetrace
> > > pg_type.typprtlen
> > > pg_type.typreceive
> > > pg_type.typsend
> > 
> > pg_type.typreceive and pg_type.typsend
> > are unused, but I think they should be saved for use as converters
> > from/to unified binary wire protocol (as their name implies ;) once we
> > get at it.
> > 
> > The alternative would be yet another system table which would allow us
> > to support unlimited number of to/from converters for different wire
> > protocols, but it will definitely be easier to start with
> > typreceive/typsend.
> 
> We can always re-add the columns them.

But would it not be nice if we could add uniform binary protocol without
requiring initdb ?

If the main concern is disk space, just set them to NULL .

------------
Hannu




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

* Re: Unused system table columns
  2002-07-15 22:03 Re: Unused system table columns Hannu Krosing <[email protected]>
@ 2002-07-16 00:19 ` Bruce Momjian <[email protected]>
  1 sibling, 0 replies; 972+ messages in thread

From: Bruce Momjian @ 2002-07-16 00:19 UTC (permalink / raw)
  To: Hannu Krosing <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; pgsql-hackers

Hannu Krosing wrote:
> > > The alternative would be yet another system table which would allow us
> > > to support unlimited number of to/from converters for different wire
> > > protocols, but it will definitely be easier to start with
> > > typreceive/typsend.
> > 
> > We can always re-add the columns them.
> 
> But would it not be nice if we could add uniform binary protocol without
> requiring initdb ?

Seems impossible that would ever happen without an initdb.

> If the main concern is disk space, just set them to NULL .

Good point, but it does confuse developers.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [email protected]               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



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

* Re: Unused system table columns
  2002-07-15 22:03 Re: Unused system table columns Hannu Krosing <[email protected]>
@ 2002-07-16 06:13 ` Tom Lane <[email protected]>
  2002-07-16 04:36   ` Re: Unused system table columns Hannu Krosing <[email protected]>
  1 sibling, 1 reply; 972+ messages in thread

From: Tom Lane @ 2002-07-16 06:13 UTC (permalink / raw)
  To: Hannu Krosing <[email protected]>; +Cc: Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; pgsql-hackers

Hannu Krosing <[email protected]> writes:
>> We can always re-add the columns them.

> But would it not be nice if we could add uniform binary protocol without
> requiring initdb ?

That won't happen, because the existing contents of those columns are
completely useless for a binary-protocol feature.

If we do ever add such a feature, we'd be better off adding new columns
with a different name, just to avoid confusion over what's supposed to
be there.  (For example: extant pg_dump scripts for user-defined types
will try to load wrong values into those columns if given a chance.
We *must* use new names for those slots in CREATE TYPE to avoid that
pitfall, and so we might as well change the system column name too.)

			regards, tom lane



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

* Re: Unused system table columns
  2002-07-15 22:03 Re: Unused system table columns Hannu Krosing <[email protected]>
  2002-07-16 06:13 ` Re: Unused system table columns Tom Lane <[email protected]>
@ 2002-07-16 04:36   ` Hannu Krosing <[email protected]>
  2002-07-16 06:44     ` Re: Unused system table columns Tom Lane <[email protected]>
  0 siblings, 1 reply; 972+ messages in thread

From: Hannu Krosing @ 2002-07-16 04:36 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; pgsql-hackers

On Tue, 2002-07-16 at 11:13, Tom Lane wrote:
> Hannu Krosing <[email protected]> writes:
> >> We can always re-add the columns them.
> 
> > But would it not be nice if we could add uniform binary protocol without
> > requiring initdb ?
> 
> That won't happen, because the existing contents of those columns are
> completely useless for a binary-protocol feature.
> 
> If we do ever add such a feature, we'd be better off adding new columns
> with a different name, just to avoid confusion over what's supposed to
> be there.  (For example: extant pg_dump scripts for user-defined types
> will try to load wrong values into those columns if given a chance.

So you know some place that actually uses the values from these columns
?

Or is it just that we have told users long enough to make them same as
typinput/typoutput ?

> We *must* use new names for those slots in CREATE TYPE to avoid that
> pitfall, and so we might as well change the system column name too.)

Can't we just add a warning when typinput==typreceive or
typoutput==typsend, or just plain refuse to make them equal and force
people to create another function binding even if they are.

The interim solution would be to set typreceive/typsend to  NULL if they
are the same as typinput/typoutput in CREATE TYPE.

-------------------
Hannu





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

* Re: Unused system table columns
  2002-07-15 22:03 Re: Unused system table columns Hannu Krosing <[email protected]>
  2002-07-16 06:13 ` Re: Unused system table columns Tom Lane <[email protected]>
  2002-07-16 04:36   ` Re: Unused system table columns Hannu Krosing <[email protected]>
@ 2002-07-16 06:44     ` Tom Lane <[email protected]>
  2002-07-16 05:04       ` Re: Unused system table columns Hannu Krosing <[email protected]>
  0 siblings, 1 reply; 972+ messages in thread

From: Tom Lane @ 2002-07-16 06:44 UTC (permalink / raw)
  To: Hannu Krosing <[email protected]>; +Cc: Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; pgsql-hackers

Hannu Krosing <[email protected]> writes:
> The interim solution would be to set typreceive/typsend to  NULL if they
> are the same as typinput/typoutput in CREATE TYPE.

Which still puts you right back at square one.  You might as well define
two new columns that will carry the function names for binary transport.

typsend/typreceive are hopelessly contaminated at this point, IMHO;
it'll be less work and less confusion to adopt other column names than
to try to reuse them just "because they're there".

			regards, tom lane



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

* Re: Unused system table columns
  2002-07-15 22:03 Re: Unused system table columns Hannu Krosing <[email protected]>
  2002-07-16 06:13 ` Re: Unused system table columns Tom Lane <[email protected]>
  2002-07-16 04:36   ` Re: Unused system table columns Hannu Krosing <[email protected]>
  2002-07-16 06:44     ` Re: Unused system table columns Tom Lane <[email protected]>
@ 2002-07-16 05:04       ` Hannu Krosing <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Hannu Krosing @ 2002-07-16 05:04 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: Bruce Momjian <[email protected]>; Peter Eisentraut <[email protected]>; pgsql-hackers

On Tue, 2002-07-16 at 11:44, Tom Lane wrote:
> Hannu Krosing <[email protected]> writes:
> > The interim solution would be to set typreceive/typsend to  NULL if they
> > are the same as typinput/typoutput in CREATE TYPE.
> 
> Which still puts you right back at square one.  You might as well define
> two new columns that will carry the function names for binary transport.

Ok, but could this be then rename instead of removing the columns - it
will be roughly the same amount of work going through all the places
that touch pg_type. I'd even guess that renaming is _less_ work..

> typsend/typreceive are hopelessly contaminated at this point, IMHO;
> it'll be less work and less confusion to adopt other column names than
> to try to reuse them just "because they're there".

-----------
Hannu





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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

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

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


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



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

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

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

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread

* [PATCH 3/9] remove excess parens around ereport
@ 2026-03-12 15:09 Álvaro Herrera <[email protected]>
  0 siblings, 0 replies; 972+ messages in thread

From: Álvaro Herrera @ 2026-03-12 15:09 UTC (permalink / raw)

---
 src/backend/commands/cluster.c | 78 ++++++++++++++++++----------------
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index db3980b84f5..af47354e382 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -992,10 +992,10 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	/* Data changes in system relations are not logically decoded. */
 	if (IsCatalogRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for catalog relations.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
 
 	/*
 	 * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -1003,28 +1003,28 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 	 */
 	if (IsToastRelation(rel))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too.")));
+				errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is not supported for TOAST relations, unless the main relation is repacked too."));
 
 	relpersistence = rel->rd_rel->relpersistence;
 	if (relpersistence != RELPERSISTENCE_PERMANENT)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("REPACK CONCURRENTLY is only allowed for permanent relations.")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
 
 	/* With NOTHING, WAL does not contain the old tuple. */
 	replident = rel->rd_rel->relreplident;
 	if (replident == REPLICA_IDENTITY_NOTHING)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot repack relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has insufficient replication identity.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot repack relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has insufficient replication identity.",
+						RelationGetRelationName(rel)));
 
 	/*
 	 * If the identity index is not set due to replica identity being, PK
@@ -1035,11 +1035,11 @@ check_repack_concurrently_requirements(Relation rel, Oid *ident_idx_p)
 		ident_idx = rel->rd_pkindex;
 	if (!OidIsValid(ident_idx))
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot process relation \"%s\"",
-						RelationGetRelationName(rel)),
-				 errhint("Relation \"%s\" has no identity index.",
-						 RelationGetRelationName(rel))));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("cannot process relation \"%s\"",
+					   RelationGetRelationName(rel)),
+				errhint("Relation \"%s\" has no identity index.",
+						RelationGetRelationName(rel)));
 
 	*ident_idx_p = ident_idx;
 }
@@ -2793,20 +2793,21 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 			ReadLocalXLogPageNoWaitPrivate *priv;
 
 			if (errm)
-				ereport(ERROR, (errmsg("%s", errm)));
+				ereport(ERROR,
+						errmsg("%s", errm));
 
 			/*
 			 * In the decoding loop we do not want to get blocked when there
 			 * is no more WAL available, otherwise the loop would become
 			 * uninterruptible.
 			 */
-			priv = (ReadLocalXLogPageNoWaitPrivate *)
-				ctx->reader->private_data;
+			priv = (ReadLocalXLogPageNoWaitPrivate *) ctx->reader->private_data;
 			if (priv->end_of_wal)
 				/* Do not miss the end of WAL condition next time. */
 				priv->end_of_wal = false;
 			else
-				ereport(ERROR, (errmsg("could not read WAL record")));
+				ereport(ERROR,
+						errmsg("could not read WAL record"));
 		}
 
 		/*
@@ -2852,7 +2853,8 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 							 timeout);
 			if (res != WAIT_LSN_RESULT_SUCCESS &&
 				res != WAIT_LSN_RESULT_TIMEOUT)
-				ereport(ERROR, (errmsg("waiting for WAL failed")));
+				ereport(ERROR,
+						errmsg("waiting for WAL failed"));
 		}
 	}
 
@@ -3050,7 +3052,8 @@ apply_concurrent_update(Relation rel, HeapTuple tup, HeapTuple tup_target,
 					  &tmfd, &lockmode, &update_indexes,
 					  false /* wal_logical */ );
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent UPDATE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent UPDATE"));
 
 	ExecStoreHeapTuple(tup, index_slot, false);
 
@@ -3091,7 +3094,8 @@ apply_concurrent_delete(Relation rel, HeapTuple tup_target)
 					  false /* wal_logical */ );
 
 	if (res != TM_Ok)
-		ereport(ERROR, (errmsg("failed to apply concurrent DELETE")));
+		ereport(ERROR,
+				errmsg("failed to apply concurrent DELETE"));
 
 	pgstat_progress_incr_param(PROGRESS_REPACK_HEAP_TUPLES_DELETED, 1);
 }
@@ -3576,7 +3580,7 @@ rebuild_relation_finish_concurrent(Relation NewHeap, Relation OldHeap,
 		 * Should not happen, given our lock on the old relation.
 		 */
 		ereport(ERROR,
-				(errmsg("identity index missing on the new relation")));
+				errmsg("identity index missing on the new relation"));
 
 	/* Gather information to apply concurrent changes. */
 	chgdst.rel = NewHeap;
@@ -3864,9 +3868,9 @@ start_decoding_worker(Oid relid)
 	decoding_worker = palloc0_object(DecodingWorker);
 	if (!RegisterDynamicBackgroundWorker(&bgw, &decoding_worker->handle))
 		ereport(ERROR,
-				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
+				errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
+				errmsg("out of background worker slots"),
+				errhint("You might need to increase \"%s\".", "max_worker_processes"));
 
 	decoding_worker->seg = seg;
 	decoding_worker->error_mqh = mqh;
@@ -3921,8 +3925,8 @@ stop_decoding_worker(void)
 
 	if (status == BGWH_POSTMASTER_DIED)
 		ereport(FATAL,
-				(errcode(ERRCODE_ADMIN_SHUTDOWN),
-				 errmsg("postmaster exited during REPACK command")));
+				errcode(ERRCODE_ADMIN_SHUTDOWN),
+				errmsg("postmaster exited during REPACK command"));
 
 	shm_mq_detach(decoding_worker->error_mqh);
 
@@ -3979,8 +3983,8 @@ RepackWorkerMain(Datum main_arg)
 	seg = dsm_attach(DatumGetUInt32(main_arg));
 	if (seg == NULL)
 		ereport(ERROR,
-				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("could not map dynamic shared memory segment")));
+				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+				errmsg("could not map dynamic shared memory segment"));
 
 	shared = (DecodingWorkerShared *) dsm_segment_address(seg);
 
-- 
2.47.3


--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0004-XLogRecPtrIsInvalid-XLogRecPtrIsValid.nocfbot.txt"



^ permalink  raw  reply  [nested|flat] 972+ messages in thread


end of thread, other threads:[~2026-03-12 15:09 UTC | newest]

Thread overview: 972+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-07-15 22:03 Re: Unused system table columns Hannu Krosing <[email protected]>
2002-07-16 00:19 ` Bruce Momjian <[email protected]>
2002-07-16 06:13 ` Tom Lane <[email protected]>
2002-07-16 04:36   ` Hannu Krosing <[email protected]>
2002-07-16 06:44     ` Tom Lane <[email protected]>
2002-07-16 05:04       ` Hannu Krosing <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess parens around ereport Álvaro Herrera <[email protected]>
2026-03-12 15:09 [PATCH 3/9] remove excess 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